package org.mod4j.dslcommon.xpand.java

class Singleton {
	def makeSingleton (String name)'''
    // Protected constructor is sufficient to suppress unauthorized calls to the constructor
    protected «name»() {}
 
    /**
     * SingletonHolder is loaded on the first execution of Singleton.getInstance() 
     * or the first access to SingletonHolder.INSTANCE , not before.
     */
     private static class SingletonHolder { 
         private final static «name» INSTANCE = new «name»();
     }
 
     public static «name» getInstance() {
         return SingletonHolder.INSTANCE;
     }
	'''
}